/**
 * Dear programmer:
 * When I wrote this code, only god and I knew how it worked.
 * Now, only god knows it!
 *
 * @author: Pegasus  Date: 2019-02-20 Time: 23:47
 */
import {SetToken} from "./Action"
import {SetCache} from "./Action"
import {SetUserSession} from "./Action"

export const onToken = (state = '', action) => {
  switch (action.type) {
    case SetToken: {
      return action.token
    }
  }
  return state
};

export const onUserSession = (state = {}, action) => {
    switch (action.type) {
        case SetUserSession: {
            return action
        }
    }
    return state
};

export const onCache = (state = {}, action) => {
    switch (action.type) {
        case SetCache: {
            return action.cache
        }
    }
    return state
};
